package com.hzy.fivepalace.common.type;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 会员类型枚举
 */
public enum VipTypeEnums {

    TYPE1(1,"PLUS会员"),
    TYPE2(2,"代理商"),
    TYPE3(3,"合伙人"),
    TYPE4(4,"股东");
    private int id;

    private String desc;

    VipTypeEnums(int id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public static List<Map> getList() {
        List<Map> list = new ArrayList<>();
        for (VipTypeEnums typeEnums : VipTypeEnums.values()) {
            Map map = new HashMap<>();
            map.put("type", typeEnums.getId());
            map.put("name", typeEnums.getDesc());
            list.add(map);
        }
        return list;
    }

    public static VipTypeEnums getEnum(int type) {
        for (VipTypeEnums typeEnums : VipTypeEnums.values()) {
            if (type == typeEnums.getId()) {
                return typeEnums;
            }
        }
        return null;
    }


    public int getId() {
        return id;
    }

    public String getDesc() {
        return desc;
    }
}
